package main

import (
	"fmt"

	"gitee.com/dark.H/go-utils/s"
)

func main() {
	raw := s.Str("@../extra_test/ex.go").ParseFileContent()
	// raw.ANSIGreen().Println()
	fmt.Println("--------- sub str test ------------")
	raw.SubStr(s.AFTER, "var").ExtractQuote().Each(func(i int, item s.EStr) {
		item.ANSIGreen().Println()
	})

	raw.SubStr(s.FROM, "{", s.TO, s.LAST, "}").ANSIYellow().Println().ExtractQuote().Each(func(i int, item s.EStr) {
		item.ANSIGreen().Println()
	})

	fmt.Println("------ edit test ---------------")

	raw.Edit(s.IN, "var (\n", ")", func(ex s.EStr) s.Str {
		return ex.Println().Insert("[test]", s.AFTER, "var (\n").Insert("[test-end]", ")")
	}).Println("[+ one]:").Edit(s.IN, "[test]", "[test-end]", func(e s.EStr) s.Str {
		return e.ANSIGreen().ANSIUnderline()
	}).Println("\n------------- sep ----------------- \n")
}
